package com.jbp.controller;

import com.jbp.model.GiftEvent;
import com.jbp.service.GiftEventService;
import com.jbp.utils.PageUtils;
import com.jbp.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import springfox.documentation.annotations.ApiIgnore;

/**
 * 活动礼物(GiftEvent)表控制层
 * @author cc
 * @since 2020-12-25 12:26:38
 */
@Api(tags ="APP接口--GiftEvent" )
@RestController
@ApiIgnore
@RequestMapping("giftEvent")
public class GiftEventController {
    @Autowired
    private GiftEventService giftEventService;

    
    @ApiOperation(value="信息")
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
        return R.ok(giftEventService.getById(id) );
    }
    
    /** 保存 */
    @RequestMapping("/save")
    public R save(@RequestBody GiftEvent giftEvent){
        giftEventService.save(giftEvent);
        return R.ok();
    }

    /** 修改 */
    @RequestMapping("/update")
    public R update(@RequestBody GiftEvent giftEvent){
        giftEventService.updateById(giftEvent);
        return R.ok();
    }

    /** 删除 */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        giftEventService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }
}